<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在线书城-全世界最大书城-个人中心</title>
    <link rel="shortcut icon" href="./images/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="./css/commons.css">
    <link rel="stylesheet" href="./css/index.css">
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_2466032_1guctssow9r.css">
    <script src="js/jquery.min.js"></script>
    <style>
        .hotpro{
            position: relative;
            height: 510px;
            top:75px;
        }
        .hotpro .main .left{
            float: left;
            width: 50px;
            height: 500px;
        }
        .hotpro .mian .left ul{
            height: 300px;
        }
        .hotpro .main .left .title{
            font-weight: bold;
            font-size: 18px;
        }
        .hotpro .main .left ul li{
            font-size: 18px;
            line-height: 50px;
            width: 120px;
            height: 50px;
            text-align: center;
        }
        .hotpro .main .right .right_top{
            height: 180px;
            border:1px solid #999999;
            margin-left: 150px;
        }
        .hotpro .main .right .right_top h3{

        }
        .hotpro .main  .right .right_top h4{
            margin-left: 20px;
        }
        .hotpro .main .right .right_top .head{
            margin-left: 2px;
            width: 100px;
            float: left;
            height: 120px;
            border:1px solid black;
        }
        .hotpro .main .right .right_top .right_order *{
            line-height: 30px;
        }
        .hotpro .main .right .right_content{
            margin-top: 4px;
            margin-left: 150px;
            border:1px solid #999999;
        }
        .hotpro .main .right .right_content table{
            text-align: center;
        }
    </style>
</head>
<body>
<!-- 头部开始 -->
<div class="header flux clearfix">
    <div class="container">
        <h1 class="logo l">
            <img src="./images/logo.jpeg" alt="">
        </h1>
        <ul class="shortcut">
            <li>
                <img src="./images/addr.png" alt="">
                北京
                <img src="./images/xia.png" alt="">
            </li>
            <li onclick="window.location.href='index.html'" class="index">首页</li>
            <li class="classify" onclick="location.href='classify.html'">分类</li>
            <li>
                <img src="./images/search.png" alt="">
                <input id="text_search" type="text" placeholder="搜索图书、课堂、文艺类">
                <button id="btn_search">搜索</button>
                <script>
                    $(function () {
                        $("#text_search").val(sessionStorage.getItem("name"));
                    });
                    $("#btn_search").click(function () {
                        let name=$("#text_search").val();
                        sessionStorage.setItem("name",name);
                        location.href="search.html";
                    })
                </script>
            </li>
            <li>
                <img src="./images/user.png" alt="">
                <span  id="toLogin" onclick="window.location.href='login.html'">登录</span>
            </li>
            <li>
                <img src="./images/phone.png" alt="">
                <span id="register" onclick="location.href='regist.html'">注册</span>
            </li>
            <li>
                <div class="shopcart" onclick="window.location.href='./shopcart.html'">
                    <i class="iconfont icon-gouwuche" style="font-size:20px"></i>
                    <span>购物车</span>
                    <span id="shopNum"></span>
                </div>
            </li>
        </ul>
    </div>
</div>
<!-- 头部结束 -->
<!-- 个人中心开始 -->
<div class="hotpro container">
    <div class="title clearfix">
        <div class="first-title l">会</div>
        <div class="second-title l">员中心</div>
    </div>
    <div class="main clearfix">
        <div class="left">
            <ul>
                <li class="title">交易记录</li>
                <li><a href="myOrder.html">我的订单</a></li>
                <li class="title">个人设置</li>
                <li><a href="address.html">地址管理</a></li>
                <li><a href="tx_replay">修改头像</a></li>
                <li><a href="#">修改密码</a></li>
            </ul>
        </div>
        <div class="right">
            <div class="right_top clearfix">
                <h3 class="title" id="wellCome">你好，xxx 欢迎回来</h3>
                <h4>用户信息</h4>
                <div class="head">
                    <img  id="user_img" src="" alt="用户头像">
                    <br/>
                    <a href="#" style="margin-left: 18px">修改头像</a>
                </div>
                <div class="right_order">
                    <p id="count">你的订单交易数量：     <a href="#">进入订单列表</a></p>
                    <p id="money">总消费金额：</p>
                    <p class="title" id="status_all"></p>
                </div>
            </div>
            <div class="right_content">
                <h3 class="title">我的订单</h3>
                <table id="orderMe" width="100%">
                    <tr class="title">
                        <th>订单编号</th>
                        <th>下单日期</th>
                        <th>收货人</th>
                        <th>支付方式</th>
                        <th>总金额</th>
                        <th>订单状态</th>
                    </tr>
                </table>
                <p style="text-align: right;padding:10px;"><a href="myOrder.html">更多订单</a></p>
            </div>
        </div><!--right end-->
    </div>
</div>
<!-- 个人中心结束 -->
<!-- 底部栏开始 -->
<div class="footer flux">
    <div class="f1 container">
        <ul>
            <li>
                <div class="tb1"></div>
                <div class="tbc">品类齐全，轻松购物</div>
            </li>
            <li>
                <div class="tb2"></div>
                <div class="tbc">多仓直发，极速配送</div>
            </li>
            <li>
                <div class="tb3"></div>
                <div class="tbc">正品行货，精致服务</div>
            </li>
            <li>
                <div class="tb4"></div>
                <div class="tbc">天天低价，畅选无忧</div>
            </li>
        </ul>
    </div>
    <div class="operator"></div>
    <div class="f2 container">
        <div>
            <ul>
                <li>购物指南</li>
                <li>
                    <a href="#">购物流程</a>
                </li>
                <li>
                    <a href="#">会员介绍</a>
                </li>
                <li>
                    <a href="#">生活旅行/团购</a>
                </li>
                <li>
                    <a href="#">常见问题</a>
                </li>
                <li>
                    <a href="#">大家电</a>
                </li>
                <li>
                    <a href="#">联系客服</a>
                </li>
            </ul>
        </div>
        <div>
            <ul>
                <li>购物指南</li>
                <li>
                    <a href="#">购物流程</a>
                </li>
                <li>
                    <a href="#">会员介绍</a>
                </li>
                <li>
                    <a href="#">生活旅行/团购</a>
                </li>
                <li>
                    <a href="#">常见问题</a>
                </li>
                <li>
                    <a href="#">大家电</a>
                </li>
                <li>
                    <a href="#">联系客服</a>
                </li>
            </ul>
        </div>
        <div>
            <ul>
                <li>购物指南</li>
                <li>
                    <a href="#">购物流程</a>
                </li>
                <li>
                    <a href="#">会员介绍</a>
                </li>
                <li>
                    <a href="#">生活旅行/团购</a>
                </li>
                <li>
                    <a href="#">常见问题</a>
                </li>
                <li>
                    <a href="#">大家电</a>
                </li>
                <li>
                    <a href="#">联系客服</a>
                </li>
            </ul>
        </div>
        <div>
            <ul>
                <li>购物指南</li>
                <li>
                    <a href="#">购物流程</a>
                </li>
                <li>
                    <a href="#">会员介绍</a>
                </li>
                <li>
                    <a href="#">生活旅行/团购</a>
                </li>
                <li>
                    <a href="#">常见问题</a>
                </li>
                <li>
                    <a href="#">大家电</a>
                </li>
                <li>
                    <a href="#">联系客服</a>
                </li>
            </ul>
        </div>
        <div>
            <ul>
                <li>购物指南</li>
                <li>
                    <a href="#">购物流程</a>
                </li>
                <li>
                    <a href="#">会员介绍</a>
                </li>
                <li>
                    <a href="#">生活旅行/团购</a>
                </li>
                <li>
                    <a href="#">常见问题</a>
                </li>
                <li>
                    <a href="#">大家电</a>
                </li>
                <li>
                    <a href="#">联系客服</a>
                </li>
            </ul>
        </div>
    </div>
    <div class="f3 container">
        <span>关于我们</span><span>|</span>
        <span>联系我们</span><span>|</span>
        <span>联系客服</span><span>|</span>
        <span>合作招商</span><span>|</span>
        <span>商家帮助</span><span>|</span>
        <span>营销中心</span><span>|</span>
        <span>English Site</span><span>|</span>
        <span>Media & IR</span>
    </div>
    <div class="f4 container">
        <span>Copyright &copy; 2020 - 2021  乐山LS.com 版权所有</span>
        <span>|</span>
        <span>消费者维权热线：4006067733经营证照</span>
        <span>|</span>
        <span>(川)网械平台备字(2020)第00004号</span>
        <span>|</span>
        <span>营业执照</span>
    </div>
</div>
<!-- 底部栏结束 -->
</body>
<script>
</script>
<script src="js/toLogin.js"></script>
<script>
    $.ajax({
        url:"order/orderAll",
        type:"get",
        success:function (res) {
            $("#count").text("你的订单交易数量:"+res.data.OrderCount+"  ");
            $("#money").text("你的总消费为:"+res.data.OrderMoney);
            let a=$("<a href='myOrder.html'>进入订单列表</a>");
            $("#count").append(a);
        }
    });

    $.ajax({
        url:"user/search",
        type:"get",
        datatype:"json",
        data:{
            "uname":sessionStorage.getItem("username"),
        },
        success:function (res) {
            $("#user_img").prop("src",res.data.avatar);
        }
    });

    $.ajax({
        url:"order/orderParam",
        type:"get",
        success:function (res) {
            let p=0;
            let s=0;
            let f=0;
            for(let i=0;i<res.length;i++){
                if(res[i]==1){
                    p++;
                }
                else if(res[i]==2){
                    s++;
                }
                else{
                    f++;
                }
            }
            $("#status_all").text("待评价的商品:("+f+") 待付款的订单:("+p+") 待确认收货:("+s+")");
        }
    });

    $.ajax({
        url:"order/orders",
        type:"get",
        datatype:"json",
        data:{
            "pageSize":2,
        },
        success:function (res) {
            let data=res.list;
            for(let i=0;i<data.length;i++){
                let tr=$("<tr></tr>");
                let td1=$("<td></td>").text(data[i].orderno);
                let td2=$("<td></td>").text(data[i].ordertime);
                let td3=$("<td></td>").text(data[i].accept);
                let td4=$("<td></td>");
                if(data[i].paytype==1){
                    td4.text("在线支付");
                }else{
                    td4.text("货到付款");
                }
                let td5=$("<td></td>").text(data[i].money);
                let td6=$("<td></td>");
                if(data[i].status==1){
                    td6.text("待支付");
                }else if(data[i].status==2){
                    td6.text("待确认收货");
                }else{
                    td6.text("待评价");
                }
                tr.append(td1,td2,td3,td4,td5,td6);
                $("#orderMe").append(tr);
            }
        }
    });

</script>
</html>